{namespace h=TaoJiang\NewsFrontEdit\ViewHelpers}
 <f:if condition="{settings.listType}==0">
	<f:then>
		<div class="form-group">
		    <label class="control-label">标题<font color="red"> *</font></label>
		    <f:form.textfield property="title"  class="form-control spinner" placeholder="新闻标题"/>
		</div>

		<div class="form-group">
		    <label class="control-label">关键字（每个关键字之间用空格区分开）</label>
		    <f:form.textfield property="keywords"  class="form-control spinner"  placeholder="请输入关键字"/>
		</div>
		
		<div class="form-group">
		    <label class="control-label">默认图片<font style="font-weight: normal;">(首页和列表页显示，建议尺寸：520px*326px)</font></label>
		    <div class="form-inline">
		        <div class="input-group ">
		            <f:form.upload name="imgpath" id="exampleInputFile" class="form-control spinner"/>
		            <p class="help-block"> "仅支持常用图片格式"</p>
		        </div>
		        <div class="input-group" id="see_image">
		            <f:if condition="{news.imgpath}">
		                <f:image src="uploads/tx_news/titles/{news.imgpath}"  class="img-responsive" maxHeight="320" maxWidth="500" />
		            </f:if>
		        </div>
		    </div>
		</div>

		<div class="form-group">
		    <label class="control-label">简介</label>
		    <f:form.textarea property="teaser" cols="80" rows="2" class="form-control spinner"/>
		</div>

		<div class="form-group">
		    <label class="control-label">内容<font color="red"> *</font></label>
		    <f:form.textfield name="ckRichText" id="ckRichText" style="display:none"/>
		    <f:form.textarea id="news_feront_edit_bodytext" property="bodytext" class="ckeditor" style="width:100%" rows="10"/>
		</div>
        <div class="form-group">
            <label class="control-label">发布时间<font color="red"> *</font></label>
            <div class="input-group date bs-datetime datetimepicker-datetime" id="datepicker" data-date-format="yyyy-mm-dd hh:ii">
                <f:form.textfield property="datetime" value="{news.datetime->f:format.date(format: 'Y-m-d H:i')}" class="form-control spinner" placeholder="Y-m-d"/>
                <span class="input-group-addon">
                    <button class="btn default date-set" type="button">
                        <i class="fa fa-calendar"></i>
                    </button>
                </span>
            </div>
        </div>
        
		<div class="form-group">
		    <label class="control-label">类别<font color="red">*</font></label>
		    <f:form.select property="categories" options="{categories}" optionValueField="uid" optionLabelField="title" style="width:100%" class="select2 form-control spinner" multiple="multiple" />
		</div>


		<div class="form-group">
		    <label class="control-label">作者<font color="red"> *</font></label>
		    <f:form.textfield property="author" class="form-control spinner" />
		</div>

		<div class="form-group">
            <label class="mt-checkbox mt-checkbox-outline">
                <f:form.checkbox property="istopnews" value="1"/> 置顶
                <span></span>
            </label>
		</div>
    </div>
	</f:then>
	<f:else>
		<div class="form-group">
		    <label class="control-label">标题<font color="red"> *</font></label>
		    <f:form.textfield property="title"  class="form-control spinner" placeholder="视频标题"/>
		</div>

		<div class="form-group">
		    <label class="control-label">视频封面图片<font color="red"> *</font><font style="font-weight: normal;">(建议尺寸：430px*240px;)</font></label>
		    <div class="form-inline">
		        <div class="input-group ">
		            <f:form.upload name="imgpath" id="exampleInputFile" class="form-control spinner"/>
		            <p class="help-block"> "仅支持常用图片格式"</p>
		        </div>
		        <div class="input-group" id="see_image">
		            <f:if condition="{news.imgpath}">
		                <f:image src="uploads/tx_news/titles/{news.imgpath}"  class="img-responsive" maxHeight="202" maxWidth="160" />
		            </f:if>
		        </div>
		    </div>
		</div>

		<div class="form-group">
		    <label class="control-label">简介</label>
		    <f:form.textarea property="teaser" cols="80" rows="2" class="form-control spinner"/>
		</div>

		<div class="form-group">
		    <label class="control-label">内容<font color="red"> *</font></label>
		    <f:form.textfield name="ckRichText" id="ckRichText" style="display:none"/>
		    <f:form.textarea id="news_feront_edit_bodytext" property="bodytext" class="ckeditor" style="width:100%" rows="10"/>
		</div>

		<div class="form-group">
		    <label class="control-label">发布时间<font color="red"> *</font></label>
		    <div class="input-group date bs-datetime datetimepicker-datetime" id="datepicker" data-date-format="yyyy-mm-dd hh:ii">
                <f:form.textfield property="datetime" value="{news.datetime->f:format.date(format: 'Y-m-d H:i')}" class="form-control spinner" placeholder="Y-m-d"/>
                <span class="input-group-addon">
                    <button class="btn default date-set" type="button">
                        <i class="fa fa-calendar"></i>
                    </button>
                </span>
            </div>
		</div>

		<div class="form-group">
		    <label class="control-label">类别<font color="red">*</font></label>
		    <f:form.select property="categories" options="{categories}" optionValueField="uid" optionLabelField="title" style="width:100%" class="select2 form-control spinner" multiple="multiple" />
		</div>

		<div class="form-group">
		    <label class="control-label">作者<font color="red"> *</font></label>
		    <f:form.textfield property="author" class="form-control spinner" />
		</div>

		<div class="form-group" style="display: none;">
		    <div class="checkbox c-checkbox">
		        <label>
		            <f:form.checkbox property="istopnews" value="1"/>
		            <span class="fa fa-check"></span> 置顶
		        </label>
		    </div>
		</div>
	</f:else>
</f:if>
<script src="typo3conf/ext/backsite/Resources/Public/scripts/bootstrap-datetimepicker.min.js?1530154830" type="text/javascript"></script>
<script type="text/javascript">
	$("#datepicker").datetimepicker({
		format: 'yyyy-mm-dd hh:ii',
		autoclose :true
	})
	$(document).ready(function(){
		//验证上传文件类型并即时显示
		$("#exampleInputFile").change(function () {
			var message = $("#see_image");
	        var filepath = $("#exampleInputFile").val();
	        var extStart = filepath.lastIndexOf(".");
	        var ext = filepath.substring(extStart, filepath.length).toUpperCase();
	        if (ext == ".PNG" || ext == ".JPG" || ext == ".JPEG") {
	        	message.empty();
	        	message.html("<img src='"+getObjectURL($(this)[0].files[0])+"' id='preview' class='img-responsive' height='202' width='160' />");
	        } else {
	          	message.empty();
	          	message.css("color","red");
	          	message.html("仅支持<br/>JPG、PNG、JPEG格式的图片");
	          	return false;
	        }
	        return true;
	    });

		jQuery.validator.addMethod("imageCheck", function(value, element) {
		    var tel = true;
		    var pt = "{news.imgpath}";
		    var setts = "{settings.listType}";
		    if(setts==1){
			    if((pt=="" || pt==null)){
			    	if(value=="" || value == null){
			    		tel=false;
				    }
			    }
		    }
		    return tel;
		}, "请上传一张照片!");

	});
</script>
